/**
 * Created by kk580 on 2017/12/11.
 */
const OSS = require('ali-oss');
let client = new OSS.Wrapper({
    region: 'oss-cn-shanghai',
    //云账号AccessKey有所有API访问权限，建议遵循阿里云安全最佳实践，部署在服务端使用RAM子账号或STS，部署在客户端使用STS。
    accessKeyId: 'LTAIAqkn3Y8stIRP',
    accessKeySecret: 'u6jMObscFqsWOBrlFKDkiwjQ3MdHUF',
    bucket: 'weigao'
});

client.put('object', '.gitignore').then(function (r1) {
    console.log('put success: %j', r1);
    console.log('put return url: %j', r1.res.requestUrls[0]);
    return client.get('object');
}).then(function (r2) {
    console.log('get success: %j', r2);
    console.log('get return url: %j', r2.res.requestUrls[0]);
}).catch(function (err) {
    console.error('error: %j', err);
});
